package com.gao.modules.userdepart.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gao.base.Result;
import com.gao.modules.user.vo.SysUserVo;
import com.gao.modules.userdepart.pojo.SysUserDepart;
import com.gao.modules.userdepart.service.SysUserDepartService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/UserDepart")
public class UserDepartController {

    @Autowired
    public SysUserDepartService sysUserDepartService;


    /**
     * @param allChildren
     * @param departName
     * @return
     */
    @ResponseBody
    @GetMapping("/queryDepartAllMemberConut")
    public Result queryDepartAllMemberConut(@RequestParam Boolean allChildren,
                                            @RequestParam String departName){

        return sysUserDepartService.queryDepartAllMemberConut(allChildren,departName);
    }

    @ResponseBody
    @GetMapping("/queryDepartAllMemberDetail")
    public IPage<SysUserVo> queryDepartAllMemberDetail(@RequestParam Boolean allChildren,
                                                       @RequestParam String departName,
                                                       @RequestParam(name = "pageNo",defaultValue = "0") Integer pageNo,
                                                       @RequestParam(name = "pageSize",defaultValue = "10") Integer pageSize){
        Page page = new Page(pageNo, pageSize);
        return sysUserDepartService.queryDepartAllMemberDetail(allChildren,departName,page);
    }
}
